//
//  HomeStatusViewController.m
//  Spa
//
//  Created by PangPond on 10/1/2556.
//  Copyright (c) พ.ศ. 2556 innova. All rights reserved.
//

#import "HomeStatusViewController.h"
#import "SettingViewController.h"
#import "CheckInViewController.h"
@interface HomeStatusViewController ()

@end

@implementation HomeStatusViewController
@synthesize homeStatViewCell = _homeStatViewCell;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
         self.title =@"Status";
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    UIBarButtonItem * settingButton = [[UIBarButtonItem alloc] initWithTitle:@"Setting" style:UIBarButtonItemStylePlain target:self action:@selector(SettingButton:)];
    self.navigationItem.rightBarButtonItem = settingButton;
    
    UIBarButtonItem* barButtonCheckIn = [[UIBarButtonItem alloc] initWithTitle:@"Check in" style:UIBarButtonItemStyleDone target:self
                                                                      action:@selector(CheckIn:)];
    self.navigationItem.leftBarButtonItem = barButtonCheckIn;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - UITableViewDataSource


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    return @"ชื่อสถานะ             สถานะ            จำนวน";
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
    
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    //////
    /*
     static NSString *CellIdentifier = @"Cell";
     
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
     if (cell == nil) {
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
     }
     */
    static NSString *CellIdentifier = @"HomeStatViewCell";
    
    HomeStatViewCell *cell = (HomeStatViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        
        [[NSBundle mainBundle] loadNibNamed:@"HomeStatViewCell" owner:self options:nil];
        
        cell = self.homeStatViewCell;
        self.homeStatViewCell = nil;
    }
    
    //config xell
    //cell.textLabel.text = @"123";
   // cell.accessoryType = UITableViewCellAccessoryNone;
    
    return cell;
}

#pragma mark - UITableViewDelegate
/*
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
 // return [ZoneTableViewCell getCellHeight];
 }
 */
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    
}

#pragma mark - function

//Setting button

- (void)viewDidDisappear:(BOOL)animated {
    
    
    
    /*
     UIBarButtonItem* barButtonItem1 = [[UIBarButtonItem alloc] initWithTitle:@"Check in" style:UIBarButtonItemStyleDone target:self
     action:@selector(CheckIn:)];
     self.navigationItem.leftBarButtonItem = barButtonItem1;
     [barButtonItem1 release];
     */
    
    // [barButtonItem release];
}
-(void)CheckIn:(id)sender{
    CheckInViewController * checkInViewController = [[CheckInViewController alloc] initWithNibName:@"CheckInViewController" bundle:[NSBundle mainBundle]];
    [self.navigationController pushViewController:checkInViewController animated:YES];
    
}
-(void)SettingButton:(id)sender{
    SettingViewController * settingViewController = [[SettingViewController alloc] initWithNibName:@"SettingViewController" bundle:[NSBundle mainBundle]];
    [self.navigationController pushViewController:settingViewController animated:YES];
    
}
@end
